﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace GenesisOne
{
    class Cloud
        :Sprite
    {
        int i = 0;
        float speed;

        public Cloud(Vector2 position, Rectangle? sourceRectangle, float speed)
            : base(position, sourceRectangle)
        {
            this.speed = speed;
        }

        public void Update(GraphicsDeviceManager graphics)
        {
            if (Position.X - 5 > graphics.PreferredBackBufferWidth)
                Position = new Vector2(-200, Position.Y);

            if (i < 70)
                Position = new Vector2(Position.X, Position.Y + 0.2f);
            else if (i < 140)
                Position = new Vector2(Position.X, Position.Y - 0.2f);
            else
                i = 0;

            Position = new Vector2(Position.X + speed, Position.Y);

            i += 1;
            
            


        }
    }
}
